package com.wcbtest.dem02.entity;

/**
 * SSH命令执行结果类
 */
public  class SshResult {
    private final int exitStatus;
    private final String stdout;
    private final String stderr;

    public SshResult(int exitStatus, String stdout, String stderr) {
        this.exitStatus = exitStatus;
        this.stdout = stdout;
        this.stderr = stderr;
    }

    public int getExitStatus() {
        return exitStatus;
    }

    public String getStdout() {
        return stdout;
    }

    public String getStderr() {
        return stderr;
    }

    public boolean isSuccess() {
        return exitStatus == 0;
    }

    @Override
    public String toString() {
        return "Exit Status: " + exitStatus + "\n" +
                "Standard Output:\n" + stdout + "\n" +
                "Error Output:\n" + stderr;
    }

}